package router

import (
	"api-gateway/handler/consts"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"

	"api-gateway/handler/api"
)

func LoadRouter(r *gin.Engine) {

	routerGroup := r.Group("v1")
	{
		apiQuestion := routerGroup.Group("api")
		{
			apiQuestion.POST("createQuestion", api.CreateQuestion)
			apiQuestion.POST("infoQuestion", api.InfoQuestion)
			apiQuestion.POST("findQuestion", api.FindQuestion)
			apiQuestion.POST("delQuestion", api.DelQuestion)
			apiQuestion.POST("updateQuestion", api.UpdateQuestion)
		}
		apiStudent := routerGroup.Group("api")
		{
			apiStudent.POST("addExam", api.AddExam)
			apiStudent.POST("register", api.Register)
			apiStudent.Use(jwt.JWTAuth(consts.JWT_SECRET))
			apiStudent.POST("infoExam", api.InfoExam)
			apiStudent.POST("answerExam", api.AnswerExam)
			apiStudent.POST("markingExam", api.MarkingExam)
			apiStudent.POST("transcript", api.Transcript)

		}
	}
}
